
import { request } from "../../request/index.js"
import regeneratorRuntime from '../../lib/runtime/runtime';
import { login } from "../../utils/asyncwx.js";
Page({
  data:{
    code:"",
  },
  // 获取用户信息
  async handleGetUserinfo(e){
  try {
      // 获取用户信息
   const {encryptedData,rawData,iv,signature} =e.detail;
   // 2 获取小程序登录后的code
   const {code} = await login();
   const loginParams = {encryptedData,rawData,iv,signature,code};
   const token = "BearereyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIzLCJpYXQiOjE1NjQ3MzAwNzksImV4cCI6MTAwMTU2NDczMDA3OH0.YPt-XeLnjV-_1ITaXGY2FhxmCe4NvXuRnRB8OMCfnPo"
   // 4 把token存入到缓存中 同时跳转到上一页面
   wx.setStorageSync("token", token);
   wx.navigateBack({
     delta: 1
   });
  } catch (error) {
    console.log(error)
  }
    
    
    
    
  }
})